const downGit = require('./downGit.js');
const init = require('./init.js');
const chalk = require('chalk');
const commonUtil = require('../utils/commonUtil');

module.exports = async function execute(cmdName, args) {
  //检查命令是否在项目根目录执行
  let except = ['init'];
  if (except.indexOf(cmdName) > -1 && !commonUtil.isRootFolder()) {
    console.log(chalk.red('请在根目录下执行如下命令：'));
    return;
  };
  console.log(args)
  switch(cmdName) {
    case 'init':
      init();
      break;
    case 'downGit':
      downGit('web');
      break;
  }
}